-- slime
-- created by chendh
-- 遗迹建筑功能-购买冈布奥及其碎片

return {
    canDevelop = function(id)
        local cond = SkyRelicFunctionM.query(id, "condition");

        if type(cond) == "table" and type(cond["awake_dungeon"]) == "table" then
            local level = SkyRelicFunctionM.getLevel(id);
            local limit = cond["awake_dungeon"][level + 1];
            if type(limit) == "number" and AwakeM.calcFinishedAwakeDungeonNum() >= limit then
                return true;
            else
                return false;
            end
        end

        return true;
    end,

    limitDevelopDesc = function(id)
        local cond = SkyRelicFunctionM.query(id, "condition");

        if type(cond) == "table" and type(cond["awake_dungeon"]) == "table" then
            local level = SkyRelicFunctionM.getLevel(id);
            local limit = cond["awake_dungeon"][level + 1];
            local curNum = AwakeM.calcFinishedAwakeDungeonNum();
            return string.format(getLocStr("awake_dungeon_limit"), SkyRelicFunctionM.query(id, "name"), limit, curNum);
        end

        return "";
    end,

    -- 获取描述
    getDesc = function(desc, id)
        -- 计算奖励的碎片
        local num = { 30, 60, 100, 100, 100, 100};

        local level = SkyRelicFunctionM.getLevel(id);

        if level > 0 then
            desc = SkyRelicFunctionM.query(id, "strength_desc");
            desc = string.gsub(desc, "{0}", tostring(num[level]));
        end
        return desc;
    end,
};
